/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 标题样式 */
h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

h2 {
    color: #34495e;
    margin-top: 30px;
    margin-bottom: 20px;
}

/* 表单样式 */
form {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

label {
    display: block;
    margin-bottom: 15px;
}

input {
    width: 100%;
    padding: 8px 12px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

input[type="datetime-local"] {
    width: calc(100% - 24px);
}

/* 按钮样式 */
button {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

button[type="submit"] {
    background-color: #2ecc71;
    width: 100%;
    margin-top: 10px;
}

button[type="submit"]:hover {
    background-color: #27ae60;
}

/* 登录/注册切换按钮 */
.auth-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.auth-toggle button {
    flex: 1;
    max-width: 150px;
}

/* 预订列表样式 */
.booking {
    background-color: white;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.booking p {
    margin: 0;
}

.booking button {
    background-color: #e74c3c;
    padding: 6px 12px;
}

.booking button:hover {
    background-color: #c0392b;
}

/* 用户信息样式 */
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.user-info button {
    background-color: #95a5a6;
}

.user-info button:hover {
    background-color: #7f8c8d;
}

/* 消息提示样式 */
.message {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    text-align: center;
}

.message.error {
    background-color: #fee;
    color: #e74c3c;
    border: 1px solid #fcc;
}

.message.success {
    background-color: #efe;
    color: #27ae60;
    border: 1px solid #cfc;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    .booking {
        flex-direction: column;
        gap: 10px;
    }
    
    .booking button {
        width: 100%;
    }
}

/* 在文件末尾添加甘特图样式 */

/* 甘特图容器 */
.gantt-container {
    margin: 20px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

/* 甘特图头部 */
.gantt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* 时间轴标题行 */
.timeline-header {
    display: inline-flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
    min-width: 100%;
    transform: translateZ(0);
    left: 0;
}

.timeline-header .day {
    flex: none;
    text-align: left;
    font-weight: bold;
    color: #2c3e50;
}

/* 时间轴容器 */
.timeline-container {
    position: relative;
    overflow-x: auto;
    width: 100%;
}

/* 时间轴内容 */
.timeline {
    position: relative;
    height: 100px;
    background: #f9f9f9;
    cursor: crosshair;
    min-width: 100%; /* 确保最小宽度填满容器 */
}

.timeline .day-column {
    flex: 1;
    border-right: 1px solid #eee;
    position: relative;
}

/* 预订块 */
.booking-block {
    position: absolute;
    height: 80px;
    background-color: #3498db;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    padding: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.booking-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.booking-user {
    font-weight: bold;
}

.booking-time {
    font-size: 11px;
    opacity: 0.9;
}

.booking-block:hover {
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transform: scale(1.02);
}

.booking-block.deletable {
    cursor: context-menu;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.booking-block.editing {
    background-color: #2ecc71;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2ecc71;
    z-index: 3;
}

.booking-block.editing .resize-handle {
    background: rgba(255, 255, 255, 0.4);
}

.booking-block.editing .resize-handle:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* 时间刻度 */
.hour-marks {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
}

.hour-mark {
    flex: 1;
    border-right: 1px dotted #ddd;
}

/* 工具提示 */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 3;
    pointer-events: none;
}

/* 甘特图缩放控制 */
.gantt-controls {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-level {
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
}

/* 时间网格 */
.time-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    /* border-left 样式现在通过 inline style 设置 */
}

/* 小时标签 */
.hour-label {
    position: absolute;
    top: 0;
    left: 2px;
    font-size: 10px;
    color: #666;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 4px;
    border-radius: 2px;
}

/* 日期分隔线（0点）加粗显示 */
.grid-line[style*="solid"] {
    z-index: 1;
}

.grid-line[style*="solid"] .hour-label {
    font-weight: bold;
    color: #333;
}

/* 时间刻度样式优化 */
.time-scale {
    position: absolute;
    left: 0;
    right: 0;
    height: 20px;
    bottom: 100%;
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #fff;
    z-index: 1;
}

.time-mark {
    position: absolute;
    bottom: 0;
    font-size: 10px;
    transform: translateX(-50%);
    color: #666;
    background: #fff;
    padding: 0 5px;
    z-index: 1;
}

.time-mark::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 15px;
    height: 5px;
    width: 1px;
    background: #ddd;
}

/* 选择区域 */
.selection-area {
    position: absolute;
    background: rgba(52, 152, 219, 0.3);
    border: 1px solid #3498db;
    pointer-events: none;
    height: 100%;
    top: 0;
    animation: pulse 1.5s infinite;
    cursor: crosshair;
}

@keyframes pulse {
    0% { border-color: #3498db; }
    50% { border-color: #2ecc71; }
    100% { border-color: #3498db; }
}

/* 右键菜单 */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 5px 0;
    z-index: 1000;
}

.context-menu-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
}

.context-menu-item:hover {
    background: #f5f5f5;
}

/* 调整手柄样式 */
.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    background: rgba(255, 255, 255, 0.2);
}

.resize-handle:hover {
    background: rgba(255, 255, 255, 0.4);
}

.resize-handle.left {
    left: 0;
}

.resize-handle.right {
    right: 0;
}

.booking-block.resizing {
    pointer-events: none;
    opacity: 0.8;
}

/* 添加平滑过渡效果 */
.timeline-header .day,
.timeline .day-column,
.booking-block,
.time-mark,
.grid-line {
    transition: all 0.2s ease-out;
}

/* 确保所有需要缩放的元素都使用同一个缩放变量 */
.timeline-header,
.timeline,
.time-scale {
    transform-origin: left;
    will-change: transform;  /* 优化性能 */
}

/* 选择信息显示 */
.selection-info {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    color: #2c3e50;
    border: 1px solid #e1e1e1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.selection-info .duration {
    margin-left: auto;
    padding: 4px 8px;
    background: #e1e1e1;
    border-radius: 3px;
    font-weight: bold;
}

/* 弹出提示样式 */
.popup-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 4px;
    color: white;
    font-size: 14px;
    z-index: 1000;
    animation: slideDown 0.3s ease-out, fadeOut 0.3s ease-out 2.7s forwards;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.popup-message.success {
    background-color: #2ecc71;
}

.popup-message.error {
    background-color: #e74c3c;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* 模态窗口样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    min-width: 300px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.modal-buttons button {
    padding: 0;
    flex: 1;
    max-width: 120px;
    font-size: 14px;
    height: 36px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    text-align: center;
}

.modal-buttons button[type="button"] {
    background-color: #95a5a6;
    color: white;
}

.modal-buttons button[type="button"]:hover {
    background-color: #7f8c8d;
}

.modal-buttons button[type="submit"] {
    background-color: #2ecc71;
    color: white;
}

.modal-buttons button[type="submit"]:hover {
    background-color: #27ae60;
}

/* 确保按钮容器内的所有按钮大小一致 */
.modal-buttons button:first-child {
    margin-right: 5px;
}

.modal-buttons button:last-child {
    margin-left: 5px;
}

/* 当前时间线样式 */
.current-time-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #e74c3c;
    z-index: 2;
    pointer-events: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* 资源选择器样式 */
.resource-selector {
    margin: 20px 0;
    padding: 15px;
    background: #f5f6fa;
    border-radius: 8px;
}

.resource-selector select {
    padding: 8px;
    font-size: 16px;
    min-width: 200px;
}

/* 资源管理样式 */
.resource-management {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.add-resource {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.add-resource input {
    flex: 1;
    padding: 8px;
}

.resource-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    margin: 5px 0;
    border-radius: 4px;
}

.delete-resource {
    background: #e74c3c;
    color: white;
    padding: 4px 8px;
}

.selected-resource-info {
    margin-top: 10px;
    padding: 8px;
    background: #e3f2fd;
    border-radius: 4px;
    color: #1976d2;
    font-size: 14px;
} 